package com.louis.kitty.admin.util;

import lombok.SneakyThrows;

import java.io.Serializable;

public class P implements Serializable {
    private static final long serialVersionUID = 1L;

    public static void throwMessageIf(boolean expression, String message) {
        if (expression) {
            throw new RuntimeException(message);
        }
    }

    public static void throwMessageIfNot(boolean expression, String message) {
        throwMessageIf(!expression,message);
    }

    @SneakyThrows
    public static void throwExceptionIf(boolean expression, Exception e) {
        if (expression) {
            throw e;
        }
    }

    public static void throwExceptionIfNot(boolean expression, Exception e) {
        throwExceptionIf(!expression,e);
    }
}
